const dts = require('rollup-plugin-dts').default;
const commonjs = require('@rollup/plugin-commonjs').default;
const resolve = require('@rollup/plugin-node-resolve').default;
const typescript = require('@rollup/plugin-typescript').default;
const terser = require('@rollup/plugin-terser').default;
const pkg = require('./package.json');

module.exports = [
    {
        input: 'src/index.ts',
        output: {
            name: 'kcoder',
            file: pkg.umd,
            format: 'umd'
        },
        plugins: [
            resolve(),
            commonjs(),
            typescript(),
            terser(),
        ]
    },
    {
        input: 'src/index.ts',
        plugins: [
            typescript(),
        ],
        output: [
            { file: pkg.main, format: 'cjs' },
            { file: pkg.esm, format: 'es' }
        ]
    },
    {
        input: 'src/index.ts',
        output: {
            name: 'kcoder',
            file: pkg.types
        },
        plugins: [
            dts()
        ]
    },
]